package observer;

/**
 * @author zhangxi
 * @date 2020/9/23
 */
public class WeatherDateDisplay implements Observer, Display {

    private float temp;
    private float pressure;

    private WeatherData weatherData;

    public WeatherDateDisplay(WeatherData weatherData) {
        this.weatherData = weatherData;
        weatherData.regist(this);
    }

    public void display() {
        System.out.println("temp:" + temp + ";" + "pressure:" + pressure
        );
    }

    public void update(float temp, float pressure) {
        this.pressure = pressure;
        this.temp = temp;
        display();
    }
}
